home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
10,000 Great Games
/
10,000 Great Games.iso
/
Product
/
66
/
data1.cab
/
Source_Files
/
Src
/
Thumper.cpp
< prev
next >
Wrap
C/C++ Source or Header
|
2000-01-16
|
800b
|
47 lines
#include "stdafx.h"
cThumper::cThumper(int _x, int _y)
: cWeapon(_x, _y, thumper, "MOVING")
{
explode_wait = THUMPER_DELAY;
push_moving_direction = FALSE;
move_object_after_hit = FALSE;
}
cThumper::~cThumper()
{
if (y_on_screen())
cEffect::make(x, y, orig, "EXPLOSIONS", 5+rnd(5), 80, 5);
}
static int hit_struct(cMovable *, cDisplayable *s, cCircle *, cCircle *)
{
((cStructure *)s)->explode = TRUE;
return TRUE;
}
int cThumper::control()
{
cWeapon::control();
bounce_on_boundaries();
// Check if we're to explode
if (!explode_wait || explode)
{
cCircle c(0, 0, THUMPER_RADIUS);
check_radial_boundaries(&c, structures, hit_struct);
return FALSE;
}
// Delete when off screen
return !in_water();
}